#####################################################################################
##
##     MOD Title:          RSS Feed (Live News)
##
##     MOD Author:         kambodianboi@yahoo.com
##
##     MOD Traductor:      reef_01 - http://www.piratesdelcaribe.com.ar/foro/index.php
##
##     MOD Description:    Agrega Noticias a tu foro usando sindicacion RSS, RDF (XML).
##                         Configurable desde el ACP, para aadir las noticias en el
##			   header, footer, portal, y/o en nueva pagina.
##
##     MOD Version:        2.1.5
##
##     Installation Level: (Facil)
##
##     Installation Time:  5 Minutos
##
##     Files To Edit:            /templates/(temp)/overall_header.tpl
##                               /templates/(temp)/overall_footer.tpl
##                               /templates/(temp)/portal_body.tpl
##                               /includes/page_header.php
##                               /includes/page_tail.php
##                               /includes/constants.php
##                               portal.php
##
#####################################################################################
## Author NOTES: Before you continue, be sure you back up your files and database.
## This hack will allow you have live RSS feed run into your site, allowing visitors
## to recieve current news from your selected sources.
##
#####################################################################################

Copy all files from the archives to your phpBB2 directory

#
#-----[ SQL ]------------------------------------------ 
#
# This mod requires a db update, upload the following and run it now.
#
# Note: only db supported at this time is MySQL

/db_update.php			to	/db_update.php

# Then run 'db_update.php' then delete the file.


#
#-----[ DO ]-------------------------------------------
#

CHMOD 777 to cache

#
#-----[ OPEN ]------------------------------------------
#

portal.php

#
#-----[ FIND ]--------------------------------------------
#

include($phpbb_root_path . 'includes/page_header.'.$phpEx);

#
#------[AFTER, ADD]--------------------------------------------
#

include_once ($phpbb_root_path . 'includes/portal_rss.' . $phpEx );

#
#-----[ OPEN ]------------------------------------------
#

/includes/constants.php

#
#-----[ FIND ]-------------------------------------------------
#

// Table names

#
#-----[ BEFORE, ADD ]----------------------------------------
#

define('PAGE_RSS', -29);
define('RSS_TABLE', $table_prefix.'rss');
define('RSS_CAT_TABLE', $table_prefix.'rss_cat');

#
#-----[ OPEN ]------------------------------------------
#

/includes/page_header.php

#
#-----[ FIND ]-------------------------------------------------
#

$template->assign_vars(array(
        'SITENAME' => $board_config['sitename'],
        'SITE_DESCRIPTION' => $site_description,

#
#-----[ BEFORE, ADD ]----------------------------------------
#

include($phpbb_root_path . 'includes/functions_rss.' . $phpEx );
// Header 0, Footer 1, News 2, Portal 3
$sql = "SELECT * FROM ".RSS_TABLE."
        WHERE rss_location = 0
        AND rss_enable = 1";

if(!$result = $db->sql_query($sql))
{
        message_die(GENERAL_ERROR, "Could not query RSS news information", "", __LINE__, __FILE__, $sql);
}

$rss_rows = array();
while( $row = $db->sql_fetchrow($result) )
{
        $rss_rows[] = $row;
}

$rss_list = "";
for($i=0;$i<count($rss_rows);$i++)
{
        $rss = new rss();
        $rss->$items_limit = $rss_rows[$i]['rss_limit'];
        $rss_items = $rss->Get($rss_rows[$i]['rss_url']);

        $max_rss = ($rss_items['items_count'] < $rss_rows[$i]['rss_limit']) ? $rss_items['items_count'] : $rss_rows[$i]['rss_limit'];

        for($j=0;$j<$max_rss;$j++)
        {
                $rss_list .= "&raquo;&nbsp;<a href=\"".$rss_items['items'][$j]['link']."\" target=\"_child\">".$rss_items['items'][$j]['title']."</a>&nbsp;&nbsp;";
        }
}

if(strlen($rss_list) > 1)
{
        $template->assign_block_vars('header_rss', array(
                                      "SCROLL_RSS" => $rss_list
                                      )
        );
}

#
#-----[ OPEN ]------------------------------------------
#

/includes/page_tail.php

#
#-----[ FIND ]-------------------------------------------------
#

$template->set_filenames(array(
        'overall_footer' => ( empty($gen_simple_header) ) ? 'overall_footer.tpl' : 'simple_footer.tpl')
);

#
#-----[ AFTER, ADD ]----------------------------------------
#

$sql = "SELECT * FROM ".RSS_TABLE."
        WHERE rss_location = 1
        AND rss_enable = 1";

if(!$result = $db->sql_query($sql))
{
        message_die(GENERAL_ERROR, "Could not query RSS news information", "", __LINE__, __FILE__, $sql);
}

$rss_rows = array();
while( $row = $db->sql_fetchrow($result) )
{
        $rss_rows[] = $row;
}

$rss_list = "";
for($i=0;$i<count($rss_rows);$i++)
{
        $rss = new rss();
        $rss->$items_limit = $rss_rows[$i]['rss_limit'];
        $rss_items = $rss->Get($rss_rows[$i]['rss_url']);

        $max_rss = ($rss_items['items_count'] < $rss_rows[$i]['rss_limit']) ? $rss_items['items_count'] : $rss_rows[$i]['rss_limit'];

        for($j=0;$j<$max_rss;$j++)
        {
                $rss_list .= "&raquo;&nbsp;<a href=\"".$rss_items['items'][$j]['link']."\" target=\"_child\">".$rss_items['items'][$j]['title']."</a>&nbsp;&nbsp;";
        }
}

if(strlen($rss_list) > 1)
{
        $template->assign_block_vars('footer_rss', array(
                                      "SCROLL_RSS" => $rss_list
                                      )
        );
}

#
#-----[ OPEN ]------------------------------------------
#

/templates/(temp)/overall_header.tpl

#
#-----[ FIND ]-------------------------------------------------
#

<table border="0" cellpadding="0" cellspacing="0" class="tbl"><tr><td class="tbll"><img src="images/spacer.gif" alt="" width="8" height="4" /></td><td class="tblbot"><img src="images/spacer.gif" alt="" width="8" height="4" /></td><td class="tblr"><img src="images/spacer.gif" alt="" width="8" height="4" /></td></tr></table>

#
#-----[ AFTER, ADD ]----------------------------------------
#

<!-- BEGIN header_rss -->
<table class="topnav" width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td>
<marquee onmouseover="this.stop();" onmouseout="this.start();" Scrolldelay="100">
<span class="gensmall">{header_rss.SCROLL_RSS}</span>
</mrquee>
</td>
</tr>
</table>
<!-- END header_rss -->

#
#-----[ OPEN ]------------------------------------------
#

/templates/(temp)/overall_footer.tpl

#
#-----[ FIND ]-------------------------------------------------
#

&copy; 2001, 2006 phpBB Group :: <a href="http://www.forumimages.com/" target="_blank">FI Theme</a> :: <a href="{U_CREDITS}">{L_CREDITS}</a></td>
</tr>
</table>

#
#-----[ AFTER, ADD ]----------------------------------------
#

<!-- BEGIN footer_rss -->
<table class="topnav" width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td>
<marquee onmouseover="this.stop();" onmouseout="this.start();" Scrolldelay="100">
<span class="gensmall">{footer_rss.SCROLL_RSS}</span>
</mrquee>
</td>
</tr>
</table>
<!-- END footer_rss -->

#
#-----[ OPEN ]------------------------------------------
#

/templates/(temp)/portal_body.tpl

#
#-----[ FIND ]-------------------------------------------------
#

<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<th colspan="2">{L_TOP_POSTERS}</th>
</tr>
<tr>

#
#----[ BEFORE, ADD ]---------------------------------------------
#
# Tambien puedes agregar el bloque1 a la izquieda y el bloque2
# a la derecha de tu Portal.
#

<!-- BEGIN rss_block1 -->
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<th colspan="1">Noticias Live</th>
</tr>
<tr>
<td class="row1" align="left"><span class="gensmall">
<marquee direction="up" scrollamount="2" onmouseover="this.stop()" onmouseout="this.start()">
<!-- BEGIN rss_portal -->
{rss_block1.rss_portal.RSS_ARTC_TIME}<br/>
&nbsp;&raquo;&nbsp;{rss_block1.rss_portal.RSS_ARTC_TITLE}<br/>
<!-- END rss_portal -->
</marquee>
</span>
</td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" class="tbl"><tr><td class="tbll"><img src="images/spacer.gif" alt="" width="8" height="4" /></td><td class="tblbot"><img src="images/spacer.gif" alt="" width="8" height="4" /></td><td class="tblr"><img src="images/spacer.gif" alt="" width="8" height="4" /></td></tr></table>
<br />
<!-- END rss_block1 -->

<!-- BEGIN rss_block2 -->
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<th colspan="1">Noticias Live</th>
</tr>
<tr>
<td class="row1" align="left"><span class="gensmall">
<marquee direction="up" scrollamount="2" onmouseover="this.stop()" onmouseout="this.start()">
<!-- BEGIN rss_portal2 -->
{rss_block2.rss_portal2.RSS_ARTC_TIME}<br/>
&nbsp;&raquo;&nbsp;{rss_block2.rss_portal2.RSS_ARTC_TITLE}<br/>
<!-- END rss_portal2 -->
</marquee>
</span>
</td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" class="tbl"><tr><td class="tbll"><img src="images/spacer.gif" alt="" width="8" height="4" /></td><td class="tblbot"><img src="images/spacer.gif" alt="" width="8" height="4" /></td><td class="tblr"><img src="images/spacer.gif" alt="" width="8" height="4" /></td></tr></table>
<br />
<!-- END rss_block2 -->

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#

#
# EXTRA NOTES
##############################################################
# To link to the online new page, simply use this code.
#

<a href="onlinenews.php" class="gensmall">Noticias en Linea</a>

